package com.teamcenter.rac.massupdate.model;

import com.teamcenter.rac.kernel.TCComponentChangeItemRevision;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@SuppressWarnings({"rawtypes","unchecked"})
public class MassUpdateChangeObjectValidationModel {
	private final String m_massUpdateProcessType;
	private Map<TCComponentChangeItemRevision, Boolean> m_changeItemRevisionValidity = new HashMap();
	private Exception[] m_errorMessages;

	public MassUpdateChangeObjectValidationModel(String paramString,
			TCComponentChangeItemRevision[] paramArrayOfTCComponentChangeItemRevision) {
		this.m_massUpdateProcessType = paramString;
		TCComponentChangeItemRevision[] arrayOfTCComponentChangeItemRevision;
		int j = (arrayOfTCComponentChangeItemRevision = paramArrayOfTCComponentChangeItemRevision).length;
		for (int i = 0; i < j; i++) {
			TCComponentChangeItemRevision localTCComponentChangeItemRevision = arrayOfTCComponentChangeItemRevision[i];
			this.m_changeItemRevisionValidity.put(localTCComponentChangeItemRevision, new Boolean(false));
		}
	}

	public String getMassUpdateProcessType() {
		return this.m_massUpdateProcessType;
	}

	public Boolean getChangeItemRevisionValidity(TCComponentChangeItemRevision paramTCComponentChangeItemRevision) {
		return (Boolean) this.m_changeItemRevisionValidity.get(paramTCComponentChangeItemRevision);
	}

	public void setChangeItemRevisionValidity(TCComponentChangeItemRevision paramTCComponentChangeItemRevision,
			Boolean paramBoolean) {
		if (!this.m_changeItemRevisionValidity.containsKey(paramTCComponentChangeItemRevision)) {
			return;
		}
		this.m_changeItemRevisionValidity.put(paramTCComponentChangeItemRevision, paramBoolean);
	}

	public TCComponentChangeItemRevision[] getChangeItemRevisions() {
		return (TCComponentChangeItemRevision[]) this.m_changeItemRevisionValidity.keySet()
				.toArray(new TCComponentChangeItemRevision[this.m_changeItemRevisionValidity.size()]);
	}

	public List<TCComponentChangeItemRevision> getChangeItemRevisionsByValidity(Boolean paramBoolean) {
		ArrayList localArrayList = new ArrayList();
		Set localSet = this.m_changeItemRevisionValidity.keySet();
		Iterator localIterator = localSet.iterator();
		while (localIterator.hasNext()) {
			TCComponentChangeItemRevision localTCComponentChangeItemRevision = (TCComponentChangeItemRevision) localIterator
					.next();
			if (((Boolean) this.m_changeItemRevisionValidity.get(localTCComponentChangeItemRevision))
					.equals(paramBoolean)) {
				localArrayList.add(localTCComponentChangeItemRevision);
			}
		}
		return localArrayList;
	}

	public Exception[] getErrorMessages() {
		return this.m_errorMessages;
	}

	public void setErrorMessages(Exception[] paramArrayOfException) {
		this.m_errorMessages = paramArrayOfException;
	}
}